package com.zdhr.igms.report.dao.impl;

import com.zdhr.igms.demain.*;
import com.zdhr.igms.report.dao.ReportDao;
import com.zdhr.igms.report.mapper.ReportMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ProjectName: igms
 * @Package: com.zdhr.igms.report.dao.impl
 * @ClassName: ReportDaoImpl
 * @Author: luolin
 * @Description: 报表Dao实现类
 * @Date: 2019-10-11 15:51
 * @Version: 1.0
 */
@Repository
public class ReportDaoImpl implements ReportDao {
    @Resource
    private ReportMapper reportMapper;

    @Override
    public int insertReportInfo(ReportInfo reportInfo) throws Exception {
        int result = reportMapper.insertReportInfo(reportInfo);
        if(result<1){
            throw new Exception("报表信息持久化失败!");
        }
        return result;
    }

    @Override
    public int insertReportData(ReportData reportData) throws Exception {
        int result = reportMapper.insertReportData(reportData);
        if(result<1){
            throw new Exception("报表列表数据信息持久化失败!");
        }
        return result;
    }

    @Override
    public int insertReportStatistics(ReportStatistics reportStatistics) throws Exception {
        int result = reportMapper.insertReportStatistics(reportStatistics);
        if(result<1){
            throw new Exception("报表结果持久化失败!");
        }
        return result;
    }

    @Override
    public int insertReportLineData(ReportLineData reportLineData) throws Exception {
        int result = reportMapper.insertReportLineData(reportLineData);
        if(result<1){
            throw new Exception("报表线性数据持久化失败!");
        }
        return result;
    }

    @Override
    public int insertRealTimeData(RealTimeData realTimeData) throws Exception {
        int result = reportMapper.insertRealTimeData(realTimeData);
        if(result<1){
            throw new Exception("实时数据持久化失败!");
        }
        return result;
    }

    @Override
    public ReportInfo reportInfoByInfo(ReportInfo reportInfo) {
        return reportMapper.reportInfoByInfo(reportInfo);
    }

    @Override
    public List<ReportData> reportDataById(ReportData reportData) {
        return reportMapper.reportDataById(reportData);
    }

    @Override
    public ReportStatistics reportStatisticsById(ReportStatistics reportStatistics) {
        return reportMapper.reportStatisticsById(reportStatistics);
    }

    @Override
    public List<ReportLineData> reportLineDataById(ReportLineData reportLineData) {
        return reportMapper.reportLineDataById(reportLineData);
    }

    @Override
    public RealTimeData queryRealTimeDataById(String id) {
        return reportMapper.queryRealTimeDataById(id);
    }

    @Override
    public List<RealTimeData> queryRealTimeDataByObject(RealTimeData realTimeData) {
        return reportMapper.queryRealTimeDataByObject(realTimeData);
    }

    @Override
    public List<RealTimeData> queryRealTimeDataByObjectPage(PageBean page,RealTimeData realTimeData) {
        return reportMapper.queryRealTimeDataByObjectPage(page,realTimeData);
    }

    @Override
    public int queryRealTimeDataByObjectReturnCount(RealTimeData realTimeData) {
        return reportMapper.queryRealTimeDataByObjectReturnCount(realTimeData);
    }
}
